import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

////  InputDemo

class InputDemo extends StatefulWidget {
	@override
	createState() => new InputDemoState();
}

class InputDemoState extends State<InputDemo> {
	// Create a text controller and use it to retrieve the current value.
	// of the TextField!
	final myController = TextEditingController();

	@override
	void dispose() {
		// Clean up the controller when disposing of the Widget.
		myController.dispose();
		super.dispose();
	}

	@override
	Widget build(BuildContext context) {
		return Scaffold(
			appBar: AppBar(
				title: Text('Retrieve Text Input'),
			),
			body: Column(
				children: <Widget>[
					Padding(
						padding: const EdgeInsets.all(16.0),
						child: TextField(
							decoration: InputDecoration(hintText: "This is placeholder"),
							controller: myController,
						),
					),

					Padding(
						padding: const EdgeInsets.all(16.0),
						child: TextFormField(
							decoration: InputDecoration(hintText: "This is placeholder"),
							controller: myController,
						),
					),

				],
			),
			floatingActionButton: FloatingActionButton(
				// When the user presses the button, show an alert dialog with the
				// text the user has typed into our text field.
				onPressed: () {
					return showDialog(
						context: context,
						builder: (context) {
							return AlertDialog(
								// Retrieve the text the user has typed in using our
								// TextEditingController
								content: Text(myController.text),
							);
						},
					);
				},
				tooltip: 'Show me the value!',
				child: Icon(Icons.text_fields),
			),
		);
	}
}